<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "hy_industry_branch".
 *
 * @property int $id
 * @property string $title 行业分馆名称
 * @property string $color_value 行业分馆色值
 * @property int $br_sort 排序
 * @property int $status 状态 0未开始 1正常  2过期
 * @property int $show 1展示  0隐藏
 * @property string $start_time 开始时间
 * @property string $end_time 结束时间
 * @property string $add_time 添加时间
 * @property string $created_at 创建时间
 * @property string $updated_at 修改时间
 * @property string $deleted_at 删除时间
 */
class Branch extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'hy_industry_branch';
    }

    /**
     * 自动更新时间
     */
    public function behaviors()
    {
        return [
            [
                'class' => \yii\behaviors\TimestampBehavior::className(),
                'value' => function () {
                    return date('Y-m-d H:i:s');
                },
            ],
        ];
    }
    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            ['title','unique'],
            [['title', 'color_value','end_time', 'start_time'], 'required'],
            [['br_sort', 'status', 'show'], 'integer'],
            [['start_time', 'end_time', 'add_time', 'created_at', 'updated_at', 'deleted_at'], 'safe'],
            [['title', 'color_value'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => '分管名称',
            'color_value' => '主题色',
            'br_sort' => '排序',
            'status' => '状态',
            'show' => '展示/隐藏',
            'start_time' => '开始时间',
            'end_time' => '结束时间',
            'add_time' => '添加时间',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'deleted_at' => 'Deleted At',
        ];
    }
}
